﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MensUnoShop.Models.ViewModels.OrderViewModel>" %>
<%@ Import Namespace="MensUnoShop.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	men'suno SHOP
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
    var ismaga = false;
    if (Model.OD.MLIST.Any(m => m.TYPE == Config.MarketType.Mangazine))
        ismaga = true;
%>

<div class="CART_CONTENT">
<img src="/Content/page_img/cart_content_top.gif" />
<div class="CART_TITLE">
<h1 class="TITLE_CHECK_ORDER">購物車</h1>
<br class="CLEAR" />
</div>
<div class="CART_FORM">
  <table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="7" bgcolor="#CCCCCC">訂單編號：<%:Model.OD.TXID %> ／ 訂購日期：<%:Model.OD.DATEIN.ToShortDateString() %></td>
    </tr>
  <tr>
    <td width="114"><div align="center"></div></td>
    <td width="97"><div align="center"></div></td>
    <td width="394"><div align="left">商品</div></td>
    <%if(!ismaga){ %><td width="62"><div align="center">顏色</div></td><%} %>
    <%else{ %><td width="62"><div align="center">期數</div></td><%} %>
    <td width="62"><div align="center">單價</div></td>
    <td width="53"><div align="center">數量</div></td>
    <td width="130"><div align="center">金額小計</div></td>
  </tr>
  <%foreach (var m in Model.OD.MLIST.Where(m => m.TYPE != Config.MarketType.Combo))
    { %>
  <tr>
    <td>&nbsp;</td>
    <td><div align="center"><img src="<%:m.IMG %>" width="75" height="75" /></div></td>
    <td valign="top"><%:m.SN %><br />
      <%:m.TITLE %><br /></td>
    <td><div align="center"><%:m.COLOR %></div></td>
    <td><div align="center">NT$<%:m.SINGLEPRICE %></div></td>
    <td><div align="center"><%:m.AMOUNT %></div></td>
    <td><div align="center">NT$<%:m.PRICE %></div></td>
  </tr>
  <%} %>

    <% foreach(var sc in Model.OD.MLIST.Where(m=>m.TYPE==Config.MarketType.Combo).GroupBy(m=>m.COMBOID)){
         int i = 0;
         int pices = sc.Count();
         int divv = pices / sc.FirstOrDefault(s=>s.AMOUNT>0).AMOUNT;
         foreach (var s in sc.OrderByDescending(o=>o.AMOUNT).ThenBy(o=>o.SN))
         {
             string cs = string.Empty;
             string cs1 = string.Empty;
             string single = string.Empty;
             string amount = string.Empty;
             string total = string.Empty;

             if (i != sc.Count() - 1)
             {
                 cs = "style=\"border-bottom:none;\"";
                 cs1 = "style=\"border-bottom:none;\"";
             }
             if ((i + 1) % divv == 0)
             {
                 cs = "style=\"border-bottom:none;\"";
                 cs1 = string.Empty;
             }
             
             if (i == 0)
             {
                 single = "NT$"+s.SINGLEPRICE.ToString();
                 amount = s.AMOUNT.ToString();
                 total = "NT$"+s.PRICE.ToString();
             }
             else
             {
                 single = string.Empty;
                 amount = string.Empty;
                 total = string.Empty;
             }
  %>
  <tr>
    <td <%=cs %>><div align="center"></div>
    </td>
    <td <%=cs1 %>><div align="center"><img src="<%:s.IMG %>" width="75" height="75" /></div></td>
    <td <%=cs1 %> valign="top"><%:s.SN%><br /><%:s.TITLE%><br />
      <span class="PRODUCT3_HOT_POINT"><%:s.DISCOUNTNOTE%></span></td>
    <td <%=cs1 %>><div align="center"><%:s.COLOR%></div></td>
    <td <%=cs %>><div align="center"><%:single%></div></td>
    <td <%=cs %>><div align="center"><%:amount%></div></td>
    <td <%=cs %>><div align="center"><%:total%></div></td>
    <td <%=cs %>><div align="center"></div></td>
  </tr>
  <%
             i++;
         }
     } %>



  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td valign="top">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
<%foreach (var d in Model.OD.DSKLIST)
    { %>
  <tr>
    <td width="115"></td>
    <td width="605"><%:d.TITLE %></td>
    <td width="130" align="center">- NT$<%:d.DEPRICE%></td>
  </tr>
  <%} %>
  <tr>
    <td width="115" class="FONT_GREEN"><div align="right">運送方式</div></td>
    <td width="605">
        <%if (Model.OD.SHIPPINGWAY == 0 && !ismaga){%>台灣地區免運費Taiwan(限時掛號、包裹)<%} %>
        <%else{%>
            寄送地區僅限台灣及離島地區，海外購買請洽客服：886-2-27316690 ext.105或電郵至<a href="hung@chicgroup.com.tw">hung@chicgroup.com.tw</a>
        <%} %>
        <%if (Model.OD.SHIPPINGWAY == 1){%>亞洲Asia(EMS/國際快捷郵件)<%} %>
        <%if (Model.OD.SHIPPINGWAY == 2){%>美洲或歐洲America and Europe(EMS/國際快捷郵件)<%} %>
        <%if (Model.OD.SHIPPINGWAY == 3){%>中美洲或歐洲America and Europe(EMS/國際快捷郵件)<%} %></td>
    <td width="130"><div align="center">NT$<%:Model.OD.DELIVERYCOST%></div></td>
  </tr>
  <tr>
    <td height="50" bgcolor="#CCCCCC">&nbsp;</td>
    <td height="50" bgcolor="#CCCCCC"><div align="right" class="FINAL_PRICE">金額總計</div></td>
    <td height="50" align="center" bgcolor="#CCCCCC" class="FINAL_PRICE">NT$<%:Model.OD.PAYPRICE %></td>
  </tr>
</table>
	<div class="BUYER_INFO">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="14%" class="FONT_GREEN"><div align="right">商品寄送資訊</div></td>
    <td width="86%">＊姓名：      <%:Model.OD.RECIPIENT.NAME %> <%:Model.OD.RECIPIENT.SEX?"小姐":"先生" %>　電話：<%:Model.OD.RECIPIENT.TEL %></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>＊寄送地址：
      <%:Model.OD.RECIPIENT.COUNTRY %>
      　
      郵遞區號：
      <%:Model.OD.RECIPIENT.ZIP %>　
      <font face="新細明體">縣市/地區 ：</font><%:Model.OD.RECIPIENT.CITY %><br /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><font face="新細明體">　　　　　　鄉/鎮/市/行政區：</font><%:Model.OD.RECIPIENT.AREA %> 　<font face="新細明體">地址：</font><%:Model.OD.RECIPIENT.ADDRESS%></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
      <div align="center">
        <INPUT TYPE="BUTTON" VALUE="回返訂單查詢" onClick="location.href='/order/query'">
        </div></td>
  </tr>
</table>

	</div>
</div>
<br class="CLEAR" />
<img src="/Content/page_img/cart_content_bottom.gif" /></div>
</asp:Content>
